package comm.qf.springmvc.controller;


import comm.qf.springmvc.pojo.User;
import comm.qf.springmvc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/users")
public class UserController {

    private UserService userService;

    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    @GetMapping("/user/{id}")
    public User findUserById(@PathVariable Long id){
        User user = userService.findUserById(id);
        return user;
    }
}
